#include <stdio.h>
#include <stdlib.h>

int getMax(int *, int);
int main(int argc, char *argv[]) {
  /* 函数：
   */
  printf("请输入元素的个数：\n");
  int count;
  scanf("%d", &count);
  int *arr;
  arr = malloc(count * sizeof(int));
  for (int i = 0; i < count; i++) {
    printf("请输入第%d个元素：", i + 1);
    scanf("%d", &arr[i]);
  }
  int rlt = getMax(arr, 5);
  printf("数组的最大值是：%d\n", rlt);
  return EXIT_SUCCESS;
}

// 求数组的最大值
int getMax(int *p, int len) {
  int max = *p;
  for (int i = 0; i < len; i++) {
    if (max < *(p + i)) {
      max = *(p + i);
    }
  }
  return max;
}
